{template 'header'}
<!--当前位置-->
<div class="location layout960">
	当前位置: <a href="{SITE_URL}">首页</a>&nbsp;»&nbsp; <a href="{SITE_URL}{$MODULE[$moduleid][moduledir]}/guestbook.php">网站留言</a>
</div>
<!--当前位置 end-->
<!--主体部分-->
<div class="layout960">
	<form action="?" id="mes-form"  method="post" onsubmit="return check();">
		<table class="post-table">
			<tr>
				<td class="left" width="90"><span style="color: #f00"> * </span>留言类型</td>
				<td>
					<select id="mes-type" title="请选择留言类型" name="post-type">
						<option value="">请选择</option>
						{loop $TYPE $k $v}
						<option value="{$v}">{$v}</option>
						{/loop}
					</select>
				</td>
			</tr>
			<tr>
				<td class="left"><span style="color: #f00"> * </span>留言内容</td>
				<td title="此留言不支持任何语法，只支持文字">
					<textarea name="post[content]" title="留言内容不能为空" rows="5" cols="70" id="content">{$content}</textarea>
					<span id="dcontent" ></span>
				</td>
			</tr>
			<tr>
				<td class="left">与我联系</td>
				<td>
					<input type="radio" name="my" value="1" id="my_1"/><label for="my_1">需要</label>&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="radio" name="my" value="0" id="my_0" checked /><label for="my_0">不需要</label>
				</td>
			</tr>
			<tbody id="gb_contact" style="display:none;">
			<tr>
				<td class="left">联系人</td>
				<td >
					<input type="text" name="post[truename]" size="10" id="truename" value="{$truename}"/>&nbsp;
					<input type="checkbox" name="post[hidden]" value="1" id="hidden" checked/><label for="hidden" title="选择匿名后,联系人姓名仅网站工作人员可见"> 匿名留言</label>
					<span id="dtruename" ></span>
				</td>
			</tr>
			<tr>
				<td class="left">联系电话</td>
				<td >
					<input type="text" name="post[telephone]" size="30" id="telephone" value="{$telephone}"/>
					<span id="dtelephone" ></span>
				</td>
			</tr>
			<tr>
				<td class="left">电子邮件</td>
				<td>
					<input type="text" name="post[email]" size="30" id="email" value="{$email}"/>
					<span id="demail" ></span>
				</td>
			</tr>
			{if $DT[im_qq]}
			<tr>
				<td class="left">QQ</td>
				<td ><input type="text" size="20" name="post[qq]" id="qq" value="{$qq}"/></td>
			</tr>
			{/if}
			{if $DT[im_ali]}
			<tr>
				<td class="left">阿里旺旺</td>
				<td ><input type="text" size="20" name="post[ali]" id="ali" value="{$ali}"/></td>
			</tr>
			{/if}
			{if $DT[im_msn]}
			<tr>
				<td class="left">MSN</td>
				<td><input type="text" size="30" name="post[msn]" id="msn" value="{$msn}"/></td>
			</tr>
			{/if}
			{if $DT[im_skype]}
			<tr>
				<td class="left">Skype</td>
				<td><input type="text" size="20" name="post[skype]" id="skype" value="{$skype}"/></td>
			</tr>
			{/if}
			</tbody>
			{if $MOD[guestbook_captcha]}
			<tr>
				<td class="left">*验证码&nbsp;&nbsp;</td>
				<td >
					{template 'captcha', 'chip'}
					<span id="dcaptcha" ></span>
				</td>
			</tr>
			{/if}
			<tr>
				<td class="left">&nbsp;</td>
				<td>
					<input id="mes-sbt" type="submit" name="submit" value=" 提交 "/>&nbsp;
					<input type="reset" value=" 重写 "/>
				</td>
			</tr>
		</table>
	</form>
</div>
<!--主体部分 end-->
<script type="text/javascript">
    seajs.use(['jquery','easyui','easyui-css'],function(){
        $("#my_1").click(function(){
            if($(this).prop('checked')){
                $("#gb_contact").show();
            }
        });
        $("#my_0").click(function(){
            if($(this).prop('checked')){
                $("#gb_contact").hide();
            }
        });
        $("#mes-sbt").click(function(){
            var title = $(this).attr("title");
            $("#mes-type,#content").validatebox({
                required:true,
                missingMessage:title
            });
            return $("#mes-form").form('validate');
        });
    });
	function check() {
		var l;
		var f;
		f = 'content';
		l = Dd(f).value.length;
		if ( l < 5 || l > 1000 ) {
			Dmsg('内容应为5-1000字，当前已输入' + l + '字', f);
			Dd(f).focus();
			return false;
		}
		{if $MOD[guestbook_captcha]}
			f = 'captcha';
			l = Dd(f).value;
			if ( !is_captcha(l) ) {
				Dmsg('请填写验证码', f);
				Dd(f).focus();
				return false;
			}
			{/if}
				return true;
			}
</script>
{template 'footer'}